package com.xinfan.io.homework;

import java.io.File;
import java.io.IOException;

/**
 * @Author xin
 * @Date 2022/6/9 14:24
 * @Version 1.0
 */
public class Homework1 {
    public static void main(String[] args) {
        String dirName = "G:\\桌面\\myTemp";
        String fileName = "hello.txt";

        File dir = new File(dirName);
        if (!dir.exists()) {
            dir.mkdirs();

        }else {
            System.out.println("文件夹已存在");
        }

        File file = new File(dirName, fileName);
        if (!file.exists()) {
            try {
                file.createNewFile();

            } catch (IOException e) {
                e.printStackTrace();
            }
        }else {
            System.out.println("文件已经存在");
        }

    }
}
